package com.kk.controller;

import com.kk.model.User;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * the class of gradle-demo
 *
 * <p>
 * .
 *
 * @author little_lunatic
 * @date 2023-06-27
 */
@RestController
public class HelloController {

    @Value("${spring.application.name}")
    private String project;

    @GetMapping("/hello")
    public String hello(@RequestParam(name = "name") String name) {
        return project + " hello, " + name;
    }


    @PostMapping("/hello")
    public User hello2(String name) {
        User user = new User(1, "", "N", "18");
        user.setName(name);
        return user;
    }

}
